#include <stdint.h>

/*----------------------------[寄存器位定义与操作]----------------------------*/

uint32_t range(uint32_t i, uint32_t j)
{
	uint32_t bit_range=0;
	for(;i<=j;i++)
	{
		bit_range |= 1<<i;
	}
	return (bit_range);
}

void Reg(volatile uint32_t * p, uint32_t range, uint32_t set)
{
	uint32_t date;
	date=*p;
	date &= ~range;
	date |= set;
	*p=date;
}

/*----------------------------[GPIO与位带]----------------------------*/

volatile uint32_t * Bit(volatile uint32_t * p, uint32_t X)
{
	return ((volatile uint32_t *)(0x42000000+((uint32_t)p-0x40000000)*32+4*X));
}
